// 定义一个多类型变量，其中数组类型元素为string或者number
let hd: string | number | object | boolean | (string | number)[] = [
  "chengzhu",
  "zhangyun",
  2024,
];
console.log(hd);

// 使用any替代上面的写法
let hd2: any = ["chengzhu", "zhangyun", 2024];
console.log(hd2);

// 使用泛型替代上面写法
let hd3: Array<any> = ["chengzhu", "zhangyun", 2024];
console.log(hd3);

// 定义数组元素为多类型
let arr1: (string | number | object | boolean)[] = ["zhangyun", 23, true];
console.log(arr1);

// 使用any定义数组元素，效果同上
let arr2: any[] = ["zhangyun", 23, true];
console.log(arr2);

// 使用泛型替代上面写法
let arr3: Array<any> = ["zhangyun", 23, true];
console.log(arr3);
